import Mock from 'mockjs';
import { isDev } from '@/api';
import commAPI from '@/mock/common';
import purchaseAPI from '@/mock/purchase';
import invoverviewApi from '@/mock/inventory';
import invInboundApi from '@/mock/inventory/inbound';
import warningApi from '@/mock/inventory/warning';
import configApi from '@/mock/config';
import manageApi from '@/mock/manage';
import manageInvoiceApi from '@/mock/manage/invoice';
import missionApi from '@/mock/mission';

Mock.setup({
  timeout: '350-600'
});

if (isDev) {
  /* ***** common 公共 ********* */
  Mock.mock(/login/, 'get', commAPI.login);
  Mock.mock(/userinfo/, 'get', commAPI.getUserInfo);
  Mock.mock(/commonstatus/, 'get', commAPI.getStatus);
  Mock.mock(/commontypes/, 'get', commAPI.getTypes);
  Mock.mock(/commonstores/, 'get', commAPI.getStores);
  Mock.mock(/commonstorekeepers/, 'get', commAPI.getStoreKeepers);
  Mock.mock(/commonstoreallkeepers/, 'get', commAPI.getStoreAllKeepers);
  Mock.mock(/commononedept/, 'get', commAPI.getOneLevelDept);
  Mock.mock(/commontwodept/, 'get', commAPI.getTwoLevelDept);
  Mock.mock(/commonemployees/, 'get', commAPI.getEmployees);
  Mock.mock(/commonsupplys/, 'get', commAPI.getSupplys);
  Mock.mock(/commonmaterials/, 'get', commAPI.getMaterials);
  Mock.mock(/commonstorage/, 'get', commAPI.getStorageSite);
  Mock.mock(/commonbasicconfigs/, 'get', commAPI.getBasicConfigs);
  Mock.mock(/commonvendorconfigs/, 'get', commAPI.getVendorConfigs);
  Mock.mock(/commonroutes/, 'get', commAPI.getRoutes);
  Mock.mock(/commoncontacts/, 'get', commAPI.getContacts);
  /* ***** purchase 采购 ********* */
  Mock.mock(/purplan/, 'get', purchaseAPI.getPurchasePlan);
  Mock.mock(/plandetail/, 'get', purchaseAPI.getPlanDetail);
  Mock.mock(/deleteplan/, 'get', purchaseAPI.deletePlan);
  Mock.mock(/saveplan/, 'get', purchaseAPI.savePlan);
  Mock.mock(/submitplan/, 'get', purchaseAPI.submitPlan);
  Mock.mock(/backplan/, 'get', purchaseAPI.backPlan);
  Mock.mock(/purorder/, 'get', purchaseAPI.getPurchaseOrder);
  Mock.mock(/orderdetail/, 'get', purchaseAPI.getOrderDetail);
  Mock.mock(/deleteorder/, 'get', purchaseAPI.deleteOrder);
  Mock.mock(/saveorder/, 'get', purchaseAPI.saveOrder);
  Mock.mock(/submitorder/, 'get', purchaseAPI.submitOrder);
  Mock.mock(/placeorder/, 'get', purchaseAPI.placeOrder);
  Mock.mock(/stateorder/, 'get', purchaseAPI.stateOrder);
  Mock.mock(/backorder/, 'get', purchaseAPI.backOrder);
  Mock.mock(/pushplans/, 'get', purchaseAPI.getPushPlans);
  Mock.mock(/pushplan/, 'get', purchaseAPI.pushPlan);
  /* ***** manage 管理 ********* */
  // *******员工管理
  Mock.mock(/stafflist/, 'get', manageApi.getStaffList);
  Mock.mock(/staffdetail/, 'get', manageApi.getStaffDetail);
  Mock.mock(/deletestaff/, 'get', manageApi.deleteStaff);
  Mock.mock(/savestaff/, 'get', manageApi.saveStaff);
  Mock.mock(/changestaffaccountstatus/, 'get', manageApi.changeStaffAccountStatus);
  // *******角色管理
  Mock.mock(/rolelist/, 'get', manageApi.getRoleList);
  Mock.mock(/savecustomrole/, 'get', manageApi.saveCustomRole);
  Mock.mock(/deleterole/, 'get', manageApi.deleteRole);
  Mock.mock(/rolelimits/, 'get', manageApi.getRoleLimits);
  Mock.mock(/saverolelimits/, 'get', manageApi.saveRoleLimits);
  Mock.mock(/defaultlimitlist/, 'get', manageApi.getDefLimitList);
  Mock.mock(/deleteroleemployee/, 'get', manageApi.deleteRoleEmployee);
  Mock.mock(/saveroleemployee/, 'get', manageApi.saveRoleEmployee);
  // *******审批管理
  Mock.mock(/approveall/, 'get', manageApi.getApproveList);
  Mock.mock(/approvespec/, 'get', manageApi.getApproveDetail);
  Mock.mock(/deleteapprove/, 'get', manageApi.deleteApprove);
  Mock.mock(/saveapprove/, 'get', manageApi.saveApprove);
  // *******物料管理
  Mock.mock(/materiellist/, 'get', manageApi.getMaterielList);
  Mock.mock(/materieloutlist/, 'get', manageApi.getMaterielOutList);
  Mock.mock(/materieltypes/, 'get', manageApi.getMaterielTypes);
  Mock.mock(/materieldetail/, 'get', manageApi.getMaterielDetail);
  Mock.mock(/deletemateriel/, 'get', manageApi.deleteMateriel);
  Mock.mock(/savemateriel/, 'get', manageApi.saveMateriel);
  // *******仓库管理
  Mock.mock(/storelist/, 'get', manageApi.getStoreList);
  Mock.mock(/storedetail/, 'get', manageApi.getStoreDetail);
  Mock.mock(/deletestore/, 'get', manageApi.deleteStore);
  Mock.mock(/savestore/, 'get', manageApi.saveStore);
  // *******供应商管理
  Mock.mock(/providerlist/, 'get', manageApi.getProviderList);
  Mock.mock(/providerdetail/, 'get', manageApi.getProviderDetail);
  Mock.mock(/deleteprovider/, 'get', manageApi.deleteProvider);
  Mock.mock(/saveprovider/, 'get', manageApi.saveProvider);
  // *******发票管理
  // *******证书管理
  Mock.mock(/credentialwarn/, 'get', manageApi.getCredentialWarn);
  Mock.mock(/credentialdevices/, 'get', manageApi.getCredentialDevices);
  Mock.mock(/savecredentialdevice/, 'get', manageApi.saveCredentialDevice);
  Mock.mock(/deletecredentialdevice/, 'get', manageApi.deleteCredentialDevice);
  Mock.mock(/credentialsupply/, 'get', manageApi.getCredentialSupplyPerson);
  Mock.mock(/savecredentialletter/, 'get', manageApi.saveCredentialLetter);
  Mock.mock(/deletecredentialletter/, 'get', manageApi.deleteCredentialLetter);
  Mock.mock(/credentialregister/, 'get', manageApi.getCredentialRegister);
  Mock.mock(/savecredentialregister/, 'get', manageApi.saveCredentialRegister);
  Mock.mock(/deletecredentialregister/, 'get', manageApi.deleteCredentialRegister);
  /* ***** inventory 库存 ********* */
  Mock.mock(/getSerial/, 'post', invInboundApi.getSerial);
  // 采购
  Mock.mock(/invpurchaselist/, 'get', manageInvoiceApi.getPurchaseList);
  Mock.mock(/invpurchasedetail/, 'get', manageInvoiceApi.getPurchaseDetail);
  Mock.mock(/deleteinvpurchase/, 'get', manageInvoiceApi.deletePurchase);
  Mock.mock(/saveinvpurchase/, 'get', manageInvoiceApi.savePurchase);
  // 数量预警 有效期预警
  Mock.mock(/warncount/, 'get', warningApi.getWarnCount);
  Mock.mock(/quantitys/, 'get', warningApi.getQuantityList);
  Mock.mock(/validitys/, 'get', warningApi.getValidityList);
  Mock.mock(/alertdetail/, 'get', warningApi.getAlertDetail);
  Mock.mock(/alertset/, 'get', warningApi.getAlertSet);
  // 库存一览
  Mock.mock(/inventory\/list/, 'post', invoverviewApi.getInventoryOverview);
  Mock.mock(/invoverviewsearchoption/, 'get', invoverviewApi.getInvSearchOption);
  Mock.mock(/inventory\/recordlist/, 'post', invoverviewApi.getRecordList);
  Mock.mock(/inventory\/warnlist/, 'post', invoverviewApi.getWarningList);
  // 入库
  Mock.mock(/inboundOrder\/list/, 'post', invInboundApi.getInventoryInboundList);
  Mock.mock(/inboundOrder\/add/, 'post', invInboundApi.addInvInbound);
  Mock.mock(/inboundOrder\/submission/, 'get', invInboundApi.submitInvInbound);
  Mock.mock(/inboundOrder\/verb/, 'get', invInboundApi.backInvInbound);
  Mock.mock(/inboundOrder\/del/, 'get', invInboundApi.deleteInvInbound);
  Mock.mock(/inboundOrder\/detail/, 'get', invInboundApi.detailInvInbound);
  Mock.mock(/queryInboundOrderNo/, 'get', invInboundApi.queryInboundOrderNo);
  // 出库
  Mock.mock(/outboundOrder\/list/, 'post', invInboundApi.getInventoryOutboundList);
  Mock.mock(/outboundOrder\/add/, 'post', invInboundApi.addInvOutbound);
  Mock.mock(/outboundOrder\/submission/, 'get', invInboundApi.submitInvOutbound);
  Mock.mock(/outboundOrder\/verb/, 'get', invInboundApi.backInvOutbound);
  Mock.mock(/outboundOrder\/del/, 'get', invInboundApi.deleteInvOutbound);
  Mock.mock(/outboundOrder\/detail/, 'get', invInboundApi.detailInvOutbound);
  // 盘点
  Mock.mock(/checkOutOrder\/list/, 'post', invInboundApi.getCheckoutList);
  Mock.mock(/checkOutOrder\/save/, 'post', invInboundApi.saveNewInvCheckout);
  Mock.mock(/checkOutOrder\/submit/, 'post', invInboundApi.submitNewInvCheckout);
  Mock.mock(/checkOutOrder\/submit\//, 'get', invInboundApi.submitInvCheckout);
  Mock.mock(/checkOutOrder\/verb/, 'get', invInboundApi.backInvCheckout);
  Mock.mock(/checkOutOrder\/del/, 'get', invInboundApi.deleteInvCheckout);
  Mock.mock(/checkOutOrder\/detail/, 'get', invInboundApi.detailInvCheckout);
  // 调拨
  Mock.mock(/transferOrder\/list/, 'post', invInboundApi.getAllotList);
  Mock.mock(/transferOrder\/save/, 'post', invInboundApi.saveNewInvAllot);
  Mock.mock(/transferOrder\/submit/, 'post', invInboundApi.submitNewInvAllot);
  Mock.mock(/transferOrder\/submit\//, 'get', invInboundApi.submitInvAllot);
  Mock.mock(/transferOrder\/verb/, 'get', invInboundApi.backInvAllot);
  Mock.mock(/transferOrder\/del/, 'get', invInboundApi.deleteInvAllot);
  Mock.mock(/transferOrder\/detail/, 'get', invInboundApi.detailInvAllot);
  // 组装拆卸
  Mock.mock(/assemOrder\/list/, 'post', invInboundApi.getAssemblyList);
  Mock.mock(/assemOrder\/save/, 'post', invInboundApi.saveNewInvAssembly);
  Mock.mock(/assemOrder\/submit/, 'post', invInboundApi.submitNewInvAssembly);
  Mock.mock(/assemOrder\/submit\//, 'get', invInboundApi.submitInvAssembly);
  Mock.mock(/assemOrder\/verb/, 'get', invInboundApi.backInvAssembly);
  Mock.mock(/assemOrder\/del/, 'get', invInboundApi.deleteInvAssembly);
  Mock.mock(/assemOrder\/detail/, 'get', invInboundApi.detailInvAssembly);
  /* ***** 配置 ********* */
  // 编码配置
  Mock.mock(/concodeList/, 'get', configApi.getConCodeList);
  Mock.mock(/concodedatasources/, 'get', configApi.getCodeDataSource);
  Mock.mock(/concodedetail/, 'get', configApi.getConCodeDetail);
  Mock.mock(/submitConCodeDetail/, 'post', configApi.submitConCodeDetail);
  // 数据配置 组织
  Mock.mock(/getCompanyDetail/, 'post', configApi.getCompanyDetail);
  Mock.mock(/updateCompanyDetail/, 'post', configApi.updateCompanyDetail);
  Mock.mock(/getDepartmentsDetail/, 'post', configApi.getDepartmentsDetail);
  Mock.mock(/updateDepartmentsDetail/, 'post', configApi.updateDepartmentsDetail);
  // 数据配置 供应链
  Mock.mock(/getDataSupplyChainDetail/, 'post', configApi.getDataSupplyChainDetail);
  Mock.mock(/updateDataSupplyChainDetail/, 'post', configApi.updateDataSupplyChainDetail);
  Mock.mock(/getDataType/, 'get', configApi.getDataType);
  Mock.mock(/getDataDetail/, 'get', configApi.getDataDetail);
  Mock.mock(/saveDataDetail/, 'post', configApi.saveDataDetail);
  // 审批任务
  Mock.mock(/approvelist/, 'get', missionApi.getApproveList);
  Mock.mock(/approveupdate/, 'get', missionApi.updateApprove);
  Mock.mock(/approvedetail/, 'get', missionApi.detailApprove);
  Mock.mock(/approveverb/, 'get', missionApi.verbApprove);
  Mock.mock(/approvedel/, 'get', missionApi.deleteApprove);
  Mock.mock(/approveagree/, 'get', missionApi.agreeApprove);
  Mock.mock(/approvereject/, 'get', missionApi.rejectApprove);
  Mock.mock(/approvereturn/, 'get', missionApi.returnApprove);
  Mock.mock(/approveback/, 'get', missionApi.revokeApprove);
}

export default Mock;
